package com.service_api.service;

import com.service_api.model.CompanyType;
import com.service_api.repository.CompanyTypeRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Sort;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class CompanyTypeService {
    @Autowired
    CompanyTypeRepository companyTypeRepository;

    public List<CompanyType> getCompanyTypeList(String city){
        Sort sort = Sort.by(Sort.Direction.DESC, "value");
        return companyTypeRepository.findAllByCity(city,sort);
    }
}
